<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 对象
        var obj = {
            // 属性名可以用引号包裹,例如出现不合法的属性名称,可以添加引号
            color:"red",
            "car-num":10,
            "price":100
        };

        // JSON
        var json = '{"color":"red","car-num":"10","price":"100"}';

        // 将对象转json
        console.log(obj,JSON.stringify(obj))
        // json转对象
        console.log(json,JSON.parse(json))
        
    </script>
</body>
</html>